<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<meta name="csrf-token" content="{{ csrf_token() }}">
		<title>账号设置</title>
		<link rel="stylesheet" type="text/css" href="css/base.css" />
		<link rel="stylesheet" type="text/css" href="css/mui.min.css" />
		<link rel="stylesheet" type="text/css" href="css/public.css" />
		<link rel="stylesheet" type="text/css" href="css/currency-setting.css" />
		<script src="js/flexible.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/mui.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/gVerify.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/jquery-3.1.1.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<header class="mui-bar mui-bar-nav">
			<a href="my" class="mui-icon mui-icon-left-nav mui-pull-left" style="color: #000;"></a>
			<h1 class="mui-title">账号设置</h1>
		</header>
		@include('error')
		@if (session('status'))
			<div class="alert alert-success">
				{{ session('status') }}
			</div>
		@endif
		<form action="setAccount" method="post">
			{{ csrf_field() }}
		<div class="content">
			<div class="flexStart settSelect">
				<span>选择交易所：</span>
				<select name="ex_id" id="ex">
					@foreach($list as $v)
						<option value="{{ $v->ex_id }}">{{ $v->name }}</option>
					@endforeach
				</select>
			</div>
			<div class="flexStart settSelect" style="margin-bottom: 0.5rem;">
				<span>状态：</span>
				<p>账号 1 <i id="acc1">未设置</i>,账号 2 <i id="acc2">未设置</i></p>
			</div>
			<ul class="proportion">
				<li class="flexStart proportionIn">
					<span>账号1：</span>
					<input type="text" name="username[]" id="" value="" />
				</li>
				<li class="flexStart proportionIn">
					<span>Access Key：</span>
					<input type="text" name="AccessKey[]" id="" value="" />
				</li>
				<li class="flexStart proportionIn">
					<span>Secret Key：</span>
					<input type="text" name="SecretKey[]" id="" value="" />
				</li>
				<li class="flexStart proportionIn">
					<span>支付密码：</span>
					<input type="password" name="pay_password[]" id="" value="" />
				</li>
				<li class="flexStart proportionIn" style="margin-top: 1rem;">
					<span>账号2：</span>
					<input type="text" name="username[]" id="" value="" />
				</li>
				<li class="flexStart proportionIn">
					<span>Access Key：</span>
					<input type="text" name="AccessKey[]" id="" value="" />
				</li>
				<li class="flexStart proportionIn">
					<span>Secret Key：</span>
					<input type="text" name="SecretKey[]" id="" value="" />
				</li>
				<li class="flexStart proportionIn">
					<span>支付密码：</span>
					<input type="password" name="pay_password[]" id="" value="" />
				</li>
				<li class="proportionIn" style="margin-top: 2rem;"><button>保存</button></li>
			</ul>
		</div>
		</form>
		<div class="navBottom flexStart">
			<a class="navBottomB" href="exchange.html">交易记录</a>
			<a class="navBottomA" href="my">我的</a>
		</div>
	</body>
<script>
    $.ajaxSetup({
        headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    });
	var add=$('#ex').val();
	$.post('isSetAccount/'+add,function(e){
		if(e.state>1){
		    $('#acc1').text('已设置');
		    $('#acc2').text('已设置');
		}else if(e.state==1){
            $('#acc1').text('已设置');
            $('#acc2').text('未设置');
		}else{
            $('#acc1').text('未设置');
            $('#acc2').text('未设置');
		}
	});
	$('#ex').change(function() {
        $.post('isSetAccount/' + add, function (e) {
            if (e.state > 1) {
                $('#acc1').text('已设置');
                $('#acc2').text('已设置');
            } else if (e.state == 1) {
                $('#acc1').text('已设置');
                $('#acc2').text('未设置');
            } else {
                $('#acc1').text('未设置');
                $('#acc2').text('未设置');
            }
        })
	});
</script>
</html>
